
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/..

workPath="../install"

export ANDROID_NDK=/opt/android-sdk/ndk/26.0.10792818

# build type Debug, Release, RelWithDebInfo and MinSizeRel

mkdir build
cd build
cmake ../ -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DANDROID_ABI="arm64-v8a" \
    -DANDROID_NDK=$ANDROID_NDK \
    -DANDROID_PLATFORM=android-30 \
    -DCMAKE_INSTALL_PREFIX=${workPath}

num=$(cat /proc/cpuinfo  | grep process | wc -l)
make -j${num} 
make install
cd -